package com.vishop.models;

import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;

@Entity
public class Klant extends Persoon  {
	@Column(unique=true)
	private int klantnummer;
	@OneToMany(cascade=CascadeType.PERSIST)
	@JoinTable(name="KlantBestellingen", joinColumns=@JoinColumn(name="klantnummer"),
	inverseJoinColumns=@JoinColumn(name="bestellingId"))
	private Collection<Bestelling> bestelling  = new ArrayList<Bestelling>();
	
	//constructor
	public Klant(){
	}

	public Klant(int klantnummer, Collection<Bestelling> bestelling){
		super();
		this.klantnummer = klantnummer;
		this.bestelling = bestelling;
	}
	//getters en setters
	public Collection<Bestelling> getBestelling() {
		return bestelling;
	}
	public void setBestelling(Collection<Bestelling> bestelling) {
		this.bestelling = bestelling;
	}
	public int getKlantnummer() {
		return klantnummer;
	}
	public void setKlantnummer(int klantnummer) {
		this.klantnummer = klantnummer;
	}

}
